package com.ttnet.beans;

import javax.annotation.PostConstruct;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;

import org.springframework.security.core.context.SecurityContextHolder;

import com.ttnet.authentication.AuthUser;

@ViewScoped
@ManagedBean(name = "loggedinUserBean")
public class LoggedinUserBean {
	private AuthUser authUser;

	@PostConstruct
	public void initModel() {
		authUser = (AuthUser) SecurityContextHolder.getContext().getAuthentication();
	}

	public AuthUser getAuthUser() {
		return authUser;
	}

	public void setAuthUser(AuthUser authUser) {
		this.authUser = authUser;
	}

}
